// 引入封装好的axios
import request from '@/api/http'

// 获取用户列表
function roleList(params) {
  return request({
    url: '/admin/sys/role/list',
    method: 'get',
    params
  })
}
/**
 * 保存角色和权限
 * @param {} params
 */
function saveRole(params) {
  return request({
    url: '/admin/sys/role/save',
    method: 'post',
    params
  })
}

function updateRole(params) {
  return request({
    url: '/admin/sys/role/update',
    method: 'post',
    params
  })
}

function getMenuByRole(params) {
  return request({
    url: '/admin/sys/role/getMenuByRole',
    method: 'get',
    params
  })
}

function getRoleDetail(params) {
  return request({
    url: '/admin/sys/role/detail',
    method: 'get',
    params
  })
}

function delRole(params) {
  return request({
    url: '/admin/sys/role/del',
    method: 'get',
    params
  })
}

export default {
  roleList,
  saveRole,
  getMenuByRole,
  updateRole,
  getRoleDetail,
  delRole
}
